package save;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.json.JSONObject;

import server.db.StmtHelper;

import ajaxmethods.SessionMethod;

public class UpdateForm extends SessionMethod {

	@Override
	public void perform(HttpServletRequest request, HttpServletResponse response)
	{
		super.perform(request, response);
		String title = request.getParameter("formname");
		String idform = request.getParameter("idform");
		if(title!=null)
		{
			try {
				StmtHelper.db("update form set formname=").addVariable(title)
				.addSql(" where idform=").addVariable(idform).executeUpdate().unsafeUpdate();
				new JSONObject().write(response.getWriter());
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
}
